import os
import platform


def util_pear(data, page_num, page_size):
    return {
        'page_num': page_num,
        'total': len(data),
        'total_page_num': len(data) // page_size if len(data) % page_size == 0 else (len(data) // page_size + 1),
        'page_size': page_size,
        'data': data[(page_num - 1) * page_size:page_num * page_size]
    }


def util_clear_screen():
    system = platform.platform()
    if system.startswith("Linux") or system.startswith("Mac"):
        os.system("clear")
    elif system.startswith("Windows"):
        os.system("cls")
